<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>两个框子的内容互相追加</title>
  <script language="JavaScript" type="text/javascript" src="js/jquery.min.js"></script>
  <script>
    $(function() {
      $("input#right").click(function() {
        //alert("sss");
        var $content = $("#select1 option:selected");
        $($content).appendTo("#select2");
      })
      $("input#left").click(function() {
        //alert("sss");
        var $content = $("#select2 option:selected");
        $($content).appendTo("#select1");
      })

      $("input#Allleft").click(function() {
        $("#select1 option").appendTo("#select2");
      });
      $("input#Allright").click(function() {
        $("#select2 option").appendTo("#select1");
      });
    })
  </script>
</head>

<body>
  <center>
    <div style="background-color:#F90; width:400px;">
      <select id="select1" multiple="multiple" style="height:150px;">
<option disabled="disabled">水果</option>
<option id="option">苹果</option>
<option id="option">香蕉</option>
<option id="option">白菜</option>
<option id="option">萝卜</option>
</select>

      <input type="button" id="right" value="移右" />
      <input type="button" id="Allright" value="全部移右" />
      <input type="button" id="left" value="移左" />
      <input type="button" id="Allleft" value="全部移左" />
      <select id="select2" multiple="multiple" style="height:150px;">
<option disabled="disabled">蔬菜</option>
<option>荔枝</option>
<option>葡萄</option>
<option>青菜</option>
<option>茄子</option>
</select>
    </div>
  </center>
</body>

</html>
